Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: f5aa05e upstream update compilation errors #681

Merged
merged 20 commits into from
Oct 31, 2024

Conversation

elfedy
Copy link
Contributor

@elfedy elfedy commented Oct 31, 2024

What 💻

Fixing compilation errors for f5aa05e upstream update.

Evidence 📷

binaries compile

NOTE: Probably best reviewed by commit

@elfedy elfedy marked this pull request as ready for review October 31, 2024 00:13
@elfedy elfedy requested a review from a team as a code owner October 31, 2024 00:13
let mut runner = runners.get(&transaction.rpc).expect("invalid rpc url").write();

let zk_metadata = transaction.zk.clone();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this purely cosmetic?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think also because transaction is later &mut borrowed (at tx_mut) so we can't get the field by itself

Copy link
Contributor Author

@elfedy elfedy Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tx_mut() takes a mutable reference to transaction but returns another type that does not have the zk field, you cannot get it from transaction either because tx is holding a mutable reference

crates/cheatcodes/src/inspector.rs Outdated Show resolved Hide resolved
crates/evm/evm/src/executors/mod.rs Show resolved Hide resolved
crates/script/src/simulate.rs Show resolved Hide resolved
crates/script/src/simulate.rs Show resolved Hide resolved
let mut runner = runners.get(&transaction.rpc).expect("invalid rpc url").write();

let zk_metadata = transaction.zk.clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think also because transaction is later &mut borrowed (at tx_mut) so we can't get the field by itself

crates/cheatcodes/src/inspector.rs Show resolved Hide resolved
@Karrq Karrq linked an issue Oct 31, 2024 that may be closed by this pull request
@elfedy elfedy merged commit 33034a2 into upstream-f5aa05e Oct 31, 2024
4 checks passed
@elfedy elfedy deleted the elfedy-f5aa05e-comperrors branch October 31, 2024 17:04
elfedy added a commit that referenced this pull request Nov 1, 2024
* chore(cheatcodes): reduce generated code (#8912)

* feat(cheatcodes): display warnings for deprecated cheatcodes (#8883)

* feat(cheatcode): disaply message for cheatcodes marked as deprecated

* Deprecated cheatcodes as hashset, displayed once per test suite

* Add deprecated cheatcode replacement attr

* Add support for fuzz and invariant tests

* Changes after review: add Deprecated(replacement)

* Update crates/cheatcodes/src/inspector.rs

Co-authored-by: DaniPopes <[email protected]>

* chore: touchups

* Fix CI

---------

Co-authored-by: DaniPopes <[email protected]>

* refactor: rewrite the console.log format string parser (#8913)

* refactor: rewrite the console.log format string parser

* chore: clippy

* feat: implement `parseTomlType` cheats (#8911)

* feat: implement `parseTomlType` cheats

* chore: `forge fmt`

* revert: use json naming to indicate to users that they are operating on json data

* chore: nit

* chore: nit

* Log address in checksum format (#8915)

Co-authored-by: jenpaff <[email protected]>

* improve description of `--flamechart` and `--flamegraph` (#8917)

improve description of --flamechart and --flamegraph, explaining the difference

* fix(forge): improve `test --debug` doc (#8918)

improve doc

* chore: use dyn InspectorExt in Backend (#8919)

* chore(evm): use dyn DatabaseExt in inspect (#8921)

chore(evm): use dyn DatabaseExt in inspect

* chore(anvil): use dyn DatabaseRef instead of generics (#8920)

* chore(doc): remove auto_impl (#8922)

* chore(docs): Update testcode path (#8923)

Update testcode path

* chore(deps): weekly `cargo update` (#8927)

* chore: don't display filter used if empty (#8929)

* chore: use serde_json::from_str when possible (#8925)

chore: use serde_json::from_str when possible

* chore: deprecate --debug regex argument (#8930)

* chore: deprecate --debug regex argument

* fix: enable full internal decoding if exactly one test matched

* chore: fixes for --all-features tests (#8937)

* chore: more fixes for --all-features tests (#8946)

* fix(`anvil`): handle OP deposit txs in `TypedTransaction` and `PoolTransaction` conversion (#8942)

* fix(`anvil`): handle OP deposit tx in TypeTransaction conversion.

* nits

* clippy

* test

Co-authored-by: grandizzy <[email protected]>

* nits

---------

Co-authored-by: grandizzy <[email protected]>

* feat(cast): add contract creation bytecodes to traces (#8941)

* fix: #8759, default (low) gas limit set even when disabled, use custom gas_limit on forks (#8933)

* fix: #8759, do not set low gas price on block if disabled, use custom gas price in forks

* test(fix): default block gas limit for large mine test

* fix fmt

* fix: optional gas_limit in as_json

* fix: use option not serde_json::Value::Null

* tests: base tests + config tests

* fix: nits

* fix: comment

* chore: add @grandizzy @yash-atreya @zerosnacks as codeowners (#8951)

add @grandizzy @yash-atreya @zerosnacks as codeowners too

* chore(deps): update revm-inspector version in manifest (#8950)

* chore: add Makefile and `codespell` (#8948)

* add makefile + codespell

* update makefile

* fix typos found by codespell

* add codespell CI task

* fix outdated spec

* ignore testdata

* switch default profile to dev, add strat to ignored words list

* chore: add comments for alloy-core patches (#8955)

* fix(coverage): better find of loc start byte position (#8958)

* chore: improve fuzz scrape bytecode test (#8953)

* chore: improve fuzz scrape bytecode test

* Remove duped comments, Trigger CI

* chore: fire shutdown signal on anvil node handle drop (#8947)

* chore: add anvil NodeHandle.fire_shutdown_signal

* Remove DAPP remappings from env vars from cli tests.

* Unwrap fire shutdown

* Fix clippy

* track_caller on fire shutdown

* fire shutdown signal on drop

* feat(`cheatcodes`): `getArtifactPathByCode` and `getArtifactPathByDeployedCode` (#8938)

* feat(`cheatcodes`): vm.getArtifactPath

* cargo cheats

* nit

* nit

* fix

* test: vm.getArtifactPath

* feat: vm.getArtifactPath(creationCode)

* cheats

* nit

* change seed

* rm vm.getArtifactPath(contractName)

* fmt

* nit

* fix

* nit

* rename

* nit

* fix

---------

Co-authored-by: grandizzy <[email protected]>

* chore: fix base gas limit test and clippy (#8961)

* feat(cheatcodes): random* cheatcodes to aid in symbolic testing (#8882)

* feat(cheatcodes): additional random cheatcodes to aid in symbolic testing

* Use arbitraryUint/address in tests

* Test changes after review

* Fix test

* Add deprecated replacements

* Changes after review:
- add fn rng back
- make sure cheats for uint/int/bytes doesn't panic + added tests

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: DaniPopes <[email protected]>

* Cargo cheats

* Fix test

* Rename Arbitrary -> Random

* Review changes: simplify randomBytes and bool

---------

Co-authored-by: DaniPopes <[email protected]>

* feat: use multi-architecture images in Dockerfile to support apple si… (#8964)

feat: use multi-architecture images in Dockerfile to support apple silicon

* fix: enable `revm/blst` (#8965)

* fix: enable revm/blst

* fix

* fix

* test: redact forge version (#8967)

* chore(tests): bump forge-std version (#8970)

chore: bump forge-std version used for tests

Co-authored-by: DaniPopes <[email protected]>

* chore(traces): remove unreachable decoding of expectRevert (#8969)

* chore(traces): remove unreachable decoding of expectRevert

* chore: clippy

* fix(`invariant`): replay should not fail for magic assume (#8966)

* fix(invariant): shrink should not fail for magic assume

* Test & Code Comment

* chore: bump max allowed verification delay (#8974)

* chore: rename `snapshot` to be more specific (#8945)

* update internal naming

* further internals

* deprecate cheats

* update Solidity tests and add dedicated test for testing deprecated cheatcodes

* clarify gas snapshots

* fix build

* final fixes

* fix build

* fix repro 6355 rename

* fix: 4844 fee fixes (#8963)

* fix: use zero blob fee for estimate

* add basic test

* fix gas_price

* support EIP-4844 with with_max_fee_per_blob_gas None

* this should run succesfully once Alloy counterpart has been merged

* undo max_fee_per_blob_gas != 0 check, not necessary anymore

* clean up

* fix setup bug from Matt

* add test with signer, currently failing on Result::unwrap()` on an `Err` value: ErrorResp(ErrorPayload { code: -32003, message: "Block `blob_versioned_hashes` is not supported before the Cancun hardfork", data: None })

* able to reproduce

* apply hotfix by Matt

* remove debugs

* use or_else, only need to do this if the blob_versioned hashes are non zero

* move blob_hashes out

---------

Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: zerosnacks <[email protected]>

* chore(deps): weekly `cargo update` (#8981)

* chore(deps): weekly `cargo update`

     Locking 41 packages to latest compatible versions
    Updating alloy-chains v0.1.33 -> v0.1.34
    Updating alloy-dyn-abi v0.8.3 -> v0.8.5
    Updating alloy-json-abi v0.8.3 -> v0.8.5
    Updating alloy-primitives v0.8.3 -> v0.8.5
    Updating alloy-sol-macro v0.8.3 -> v0.8.5
    Updating alloy-sol-macro-expander v0.8.3 -> v0.8.5
    Updating alloy-sol-macro-input v0.8.3 -> v0.8.5
    Updating alloy-sol-type-parser v0.8.3 -> v0.8.5
    Updating alloy-sol-types v0.8.3 -> v0.8.5
    Updating async-trait v0.1.82 -> v0.1.83
    Updating autocfg v1.3.0 -> v1.4.0
    Updating aws-config v1.5.6 -> v1.5.7
    Updating aws-sdk-kms v1.44.0 -> v1.45.0
    Updating aws-sdk-sso v1.43.0 -> v1.44.0
    Updating aws-sdk-ssooidc v1.44.0 -> v1.45.0
    Updating aws-sdk-sts v1.43.0 -> v1.44.0
    Updating aws-smithy-types v1.2.6 -> v1.2.7
    Updating axum v0.7.6 -> v0.7.7
    Updating axum-core v0.4.4 -> v0.4.5
    Updating cc v1.1.21 -> v1.1.22
    Updating evmole v0.5.0 -> v0.5.1
    Updating flate2 v1.0.33 -> v1.0.34
    Updating hyper-util v0.1.8 -> v0.1.9
    Updating libc v0.2.158 -> v0.2.159
    Updating portable-atomic v1.8.0 -> v1.9.0
    Updating redox_syscall v0.5.4 -> v0.5.6
    Updating revm v14.0.2 -> v14.0.3
    Updating revm-interpreter v10.0.2 -> v10.0.3
    Updating revm-precompile v11.0.2 -> v11.0.3
      Adding revm-primitives v10.0.0
    Updating rustls-pki-types v1.8.0 -> v1.9.0
    Updating serde_spanned v0.6.7 -> v0.6.8
    Updating syn v2.0.77 -> v2.0.79
    Updating syn-solidity v0.8.3 -> v0.8.5
    Updating tempfile v3.12.0 -> v3.13.0
      Adding tokio-tungstenite v0.24.0
    Updating toml_edit v0.22.21 -> v0.22.22
    Updating tonic v0.12.2 -> v0.12.3
      Adding tungstenite v0.24.0
    Updating wasm-streams v0.4.0 -> v0.4.1
    Updating winnow v0.6.18 -> v0.6.20
note: pass `--verbose` to see 143 unchanged dependencies behind latest

* fixes

* chore: clippy

---------

Co-authored-by: mattsse <[email protected]>
Co-authored-by: DaniPopes <[email protected]>

* fix(forge): generate `evm.legacyAssembly` extra output (#8987)

fix(forge): include legacyAssembly output

* chore: bump alloy-core deps + revm (#8988)

* chore: bump alloy-core deps + revm

* bump alloy to 0.4.0

* bump revm-inspectors + type casting to u128

* fix

* Revert "fix"

This reverts commit 5e0e0d1128b6819acf600b42372156738e666247.

* Revert "bump revm-inspectors + type casting to u128"

This reverts commit 25aa23cffaadef1d047ce7b359b4d7ad5018704a.

* Revert "bump alloy to 0.4.0"

This reverts commit f9721e00f5ba726c4fea6651839d65b45faae488.

* replace std HashMap with alloy_primitives maps

* bump compilers

* replace remaining HashMaps

* fmt

* nit

* replace HashSets

* fmt

* fix(ci): flexibly handle forge-std being installed with tag or untagged (#9003)

flexible handle forge-std being installed with tag or untagged

* docs: clarify keystore path should point to a filename (#9004)

clarify that you should point to a keystore by its file but it can be a custom directory

* feat: gas snapshots over arbitrary sections  (#8952)

* update internal naming

* further internals

* deprecate cheats

* update Solidity tests and add dedicated test for testing deprecated cheatcodes

* clarify gas snapshots

* fix build

* final fixes

* fix build

* fix repro 6355 rename

* add gas snapshot setup from #8755

* fix build + clippy warnings

* fix cheatcodes

* account for fixed CREATE / CALL gas cost

* remove import

* add stipend

* recalculate after a - b setup

* clear call_stipend, update tests

* avoid double counting external calls

* update cheatcodes, remove debug prints

* enable assertions

* clean up tests

* clean up test names

* remove snapshot directory on `forge clean`

* do not remove all snapshots by default due to multiple test suites being able to be ran concurrently or sequentially + optimize gas snapshots check - skip if none were captured

* handle edge case where we ask to compare but file does not exist, remove snapshot directory at a top level before test suites are ran

* fix path issue when attempting removal

* Update crates/cheatcodes/src/evm.rs

Co-authored-by: Arsenii Kulikov <[email protected]>

* Update crates/cheatcodes/src/inspector.rs

Co-authored-by: Arsenii Kulikov <[email protected]>

* refactor, apply recommended changes for last_snapshot_group, last_snapshot_name

* remove gas snapshots from fuzz tests for now: this is largely due to it conflicting with the FORGE_SNAPSHOT_CHECK where it is highly likely that with different fuzzed input the gas measurement differs as well. In the future it would be an idea to capture the average gas

* fix clippy

* avoid setting to 0 unnecessarily

* use if let Some

* improve comments, clarify use of last_gas_used != 0

* fix merge conflict issue

* fix arg ordering to address group naming regression

* fix import

* move snapshot name derivation to helper

* only skip initial call w/ overhead, no special handling for call frames

* add flare test

* style nits + use helper method

---------

Co-authored-by: Arsenii Kulikov <[email protected]>

* chore(deps): bump alloy to 0.4.2 (#9000)

* chore: bump alloy-core deps + revm

* bump alloy to 0.4.0

* bump revm-inspectors + type casting to u128

* fix

* fix

* fix

* bump foundry-fork-db

* bump alloy

* fix

* gas related field to u64

* fmt

* change gas fields types to u64 in DepositTx, TxEssentials

* chore: print parent beacon root (#9006)

Co-authored-by: DaniPopes <[email protected]>

* chore: use dyn DatabaseExt everywhere (#8924)

* wip

* feat: use `dyn DatabaseExt` (#9010)

* wip

* clean up

* fix

* clippy

* doc

* fix imports

* chore: simplify InspectorExt by making it lifetime-generic

* fmt

* chore: remove unnecessary casts and lifetimes

* chore: more unused lifetimes (clippy)

---------

Co-authored-by: DaniPopes <[email protected]>

---------

Co-authored-by: Arsenii Kulikov <[email protected]>

* feat: `--eof` flag and config key (#9002)

* feat: --eof flag and config key

* not windows

---------

Co-authored-by: grandizzy <[email protected]>

* perf: reduce dynamic dispatch for inspectors (#9011)

* feat(randomBytes): adding support to generate different bytes via RngCore (#8996)

* feat(randomBytes): adding support to generate different bytes via RngCore

Signed-off-by: Abhishekkochar <[email protected]>

* Added needed changes to util file

Signed-off-by: Abhishekkochar <[email protected]>

* Added support to get random 4 and 8 bytes

Signed-off-by: Abhishekkochar <[email protected]>

* Refractor code to suggested changes

Signed-off-by: Abhishekkochar <[email protected]>

* Fixed import with B32

Signed-off-by: Abhishekkochar <[email protected]>

* updated cheatcodes.json file

Signed-off-by: Abhishekkochar <[email protected]>

* docs

---------

Signed-off-by: Abhishekkochar <[email protected]>
Co-authored-by: DaniPopes <[email protected]>

* chore: add more context to sourcemap error (#9015)

* fix: only test `--eof` on linux (#9016)

fix: only test --eof on linux

* fix(cheatcodes): handle create2 deployer with broadcastRawTransaction (#9020)

fix(cheatcodes): fix deploy create with broadcastRawTransaction

* fix(`anvil`): set `storage.best_hash` while loading state (#9021)

* fix(anvil): set `storage.best_hash` while loading state

* clippy nit

* test: strengthen can_load_state

* chore: reduce size of DynCheatcode vtable (#9023)

* chore: unify tx env filling + add missing members (#9022)

* chore: fix clippy (#9028)

* fix(`--isolate`): track state in journal (#9018)

* track in journal

* wip

* add test

* forge fmt

* rm selfdestruct test

* fix: handle large years (#9032)

* fix(`forge eip712`): fix handling of subtypes (#9035)

* fix(forge eip712): fix handling of subtypes

* fmt

* clippy

* chore(deps): weekly `cargo update` (#9041)

Locking 40 packages to latest compatible versions
    Updating alloy-chains v0.1.34 -> v0.1.36
    Updating alloy-network-primitives v0.4.0 -> v0.4.2
    Updating alloy-rpc-types-anvil v0.4.0 -> v0.4.2
    Updating alloy-rpc-types-engine v0.4.0 -> v0.4.2
    Updating alloy-rpc-types-eth v0.4.0 -> v0.4.2
    Updating alloy-rpc-types-trace v0.4.0 -> v0.4.2
    Updating alloy-rpc-types-txpool v0.4.0 -> v0.4.2
    Updating async-compression v0.4.12 -> v0.4.13
    Updating async-stream v0.3.5 -> v0.3.6
    Updating async-stream-impl v0.3.5 -> v0.3.6
    Updating aws-config v1.5.7 -> v1.5.8
    Updating aws-sdk-kms v1.45.0 -> v1.46.0
    Updating aws-sdk-sso v1.44.0 -> v1.45.0
    Updating aws-sdk-ssooidc v1.45.0 -> v1.46.0
    Updating aws-sdk-sts v1.44.0 -> v1.45.0
    Updating cc v1.1.24 -> v1.1.25
    Updating clap v4.5.18 -> v4.5.19
    Updating clap_builder v4.5.18 -> v4.5.19
    Updating clap_complete v4.5.29 -> v4.5.32
    Updating futures v0.3.30 -> v0.3.31
    Updating futures-channel v0.3.30 -> v0.3.31
    Updating futures-core v0.3.30 -> v0.3.31
    Updating futures-executor v0.3.30 -> v0.3.31
    Updating futures-io v0.3.30 -> v0.3.31
    Updating futures-macro v0.3.30 -> v0.3.31
    Updating futures-sink v0.3.30 -> v0.3.31
    Updating futures-task v0.3.30 -> v0.3.31
    Updating futures-util v0.3.30 -> v0.3.31
    Updating gcloud-sdk v0.25.6 -> v0.25.7
      Adding hashbrown v0.15.0
    Updating indexmap v2.5.0 -> v2.6.0
    Updating ipnet v2.10.0 -> v2.10.1
    Updating once_cell v1.20.1 -> v1.20.2
    Updating pin-project v1.1.5 -> v1.1.6
    Updating pin-project-internal v1.1.5 -> v1.1.6
    Updating rustls v0.23.13 -> v0.23.14
    Updating snapbox v0.6.17 -> v0.6.18
    Updating terminal_size v0.3.0 -> v0.4.0
    Updating unicode-bidi v0.3.15 -> v0.3.17
      Adding unicode-width v0.2.0
note: pass `--verbose` to see 9 unchanged dependencies behind latest

Co-authored-by: mattsse <[email protected]>

* fix: normalize EVM version in chisel (#9040)

* fix: normalize EVM version in chisel

* rm test

* clippy

* fix

* fix(`cheatcodes`): mark `vm.breakpoint` as `pure`  (#9051)

breakpoint external -> external pure

* fix: include `traces` field when running `forge test -vvvv --json` (#9034)

* enable traces as part of verbose output when tests are ran with --json, includes tests

* Update crates/forge/tests/cli/test_cmd.rs

Co-authored-by: DaniPopes <[email protected]>

* Update crates/forge/tests/cli/test_cmd.rs

Co-authored-by: DaniPopes <[email protected]>

* use forgetest! directly

---------

Co-authored-by: DaniPopes <[email protected]>

* feat(cheatcodes): Add `vm.mockCalls` to mock different return data for multiple calls (#9024)

* Refactor vm.mockCall to be based on mutable VecDeque

* Add vm.mockCalls cheatcode

* Refactor mock_call to be wrapper for mock_calls

* Add a test to vm.mockCalls

* Add test for vm.mockCalls with msg.value

* Fix fmt & clippy following vm.mockCalls implementation

* Fix Solidity fmt in testdata/default/cheats/MockCalls.t.sol

* Add test in MockCalls.t.sol to check last mocked data persists

* Remove allow(clippy::ptr_arg) from mock_call & mock_calls

* Apply suggestions from code review

---------

Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: DaniPopes <[email protected]>

* chore(deps): bump alloy-core 0.8.6 (#9045)

* feat(cheatcodes): add vm.cloneAccount() cheatcode (#9048)

* feat(cheatcodes): add vm.cloneAccount() cheatcode

* Fmt

* Cargo cheats

* Changes after review:
- use autogenerated getter
- consistent clone naming
- nits

* fix(`anvil`): eth_gasPrice returned `1000000000` with `--block-base-fee-per-gas 0`, adds new `--disable-min-priority-fee` to return `0` (#9049)

* add new flag to disable min suggested priority fee: `--disable-min-priority-fee`

* documentation

* remove unnecessary value_name

* feat: update to Soldeer v0.4.0 (#9014)

* updated to version 0.4.0

* fmt and clippy

* added cargo modifications

* solving small nits

* forcing special chars on windows

* escaping special chars

* removing stderr checks

* fmt

* remvoving err assert from login

* fix(invariant): do not commit state if assume returns (#9062)

* feat(`cheatcodes`): vm.getScriptWallets() (#9052)

* feat(`cheatcodes`): vm.getScriptWallets()

* feat: load default anvil accounts in script

* Revert "feat: load default anvil accounts in script"

This reverts commit 4d64356a51bf226482269a2af47f947c4e49e462.

* clippy

* test

---------

Co-authored-by: grandizzy <[email protected]>

---------

Co-authored-by: grandizzy <[email protected]>

* fix: support EOF opcodes in `cast da` (#9070)

* fix: support EOF opcodes in cast da

* fix

* fix doc

* fmt

* feat(forge): allow passing value to `--optimize` (#9071)

feat(forge): allow passing value to --optimize

* fix(forge): add logs/decoded logs in json test results (#9074)

* fix(`forge`): avoid panic when empty fuzz selectors in invariants (#9076)

* chore(`anvil`): use op-alloy types (#9047)

* fix: redact RPC URLs in traces if URL is passed in directly (#9077)

redact RPC urls if string is a URL, not an alias

* test: relax pragmas (#9078)

* test: relax pragmas

* test: update rust tests too

* feat(cheatcode): `startDebugTraceRecording` and `stopDebugTraceRecording` for ERC4337 testing (#8571)

* feat: add record opcode cheat code

feat: capture stack inputs as part of the opcode

feat: record opcode -> record debug trace

fix: memory OOG, need to only use needed stack, mem input

fix: missing op code, instruction results

fix: accessing out-of-bound idx memory

When running on some project, we noticed that it sometimes try to access memory with out of bound
index and panics.

This commit fix it by:
1. Enfore reset to Nonce after stopDebugTraceRecording(), this ensures the `some(..) = ...` part will not be triggered
2. Change how opcode_utils.rs accesses memory. Return empty vector if trying access out-of-bound memory.

* test: add DebugTrace.t.sol for the debug trace cheatcode

* fix: rebase errors

* feat: use tracer for debug trace instead of recording during inspector

This commit also cleans up the previous implementaiton on inspector.
And then change the cheatcode interface to be of three steps:
1. start recording debug trace
2. stop recording
3. get the debug trace by index

The reason is to avoid out-of-memory issue by returning the whole traces at once.

* fix: rebase duplication

* feat: replace instruction result with isOutOfGas

* fix: CI issues

* fix: remove DebugTrace wrapper in inspector

* fix: revert to original tracer config when stops

* chore: reuse existing opcode functions

* chore: refactor, fmt, clippy run

* chore: use ref instead of clone, returning Error when not able to access

* chore: move buffer to evm_core from debugger

* fix: disable dummy tracer by default, return explicit error

Since enabling dummy tracer still come with performance impact, remove the auto dummy tracer
initiation. The cheatcode will return explicit error and require the test to be run in -vvv mode
to have the tracer enabled by default.

* fix: return all traces, turn on necessary tracer config

There was OOM concern but using the get-by-index style, despite improved, does not solve the root cause.
The main issue is that the tracer config did not turn off after the stop recording cheatcode being called.
It seems too much burden for the tracer to record the returned traces inside forge tests as the tests will
also pass around the debug traces, causing memory boost.

This commit also only turns on necessary tracer config instead of using all().

* chore: cleanup comments, typo

* fix: use bytes for memory, remove flattern function, fix get_slice_from_memory

* fix: style fmt

* fix: ensure steps in the order of node when flatten

A node can have steps that calls to another node, so the child node's step might occur before
some steps of its parent node. This introduce the flatten_call_trace function back using
recursive call to ensure the steps are in correct order despite not in the same order of the
node index.

see PR comment: foundry-rs/foundry#8571 (comment)

* doc: remove legacy comment in test

* style: reuse empty initialized var on return val

---------

Co-authored-by: zerosnacks <[email protected]>

* feat(`forge doc`): include @Custom natspec (#9075)

* feat(`forge doc`): include @Custom natspec

* chore: make clippy happy

* test: implement test for `is_custom`

* chore: make rustfmt happy

* doc: nit

* chore: format custom tags

* chore: add alias (#9082)

add alias

* fix(chisel): final statement & fetch err with complex type fixes (#9081)

* fix(chisel): consider assembly block return as final statement

* Fix 4938

* Start from first assembly block when checking for return statement

* Fix 6618

* feat(chisel): add eval command (#9086)

* feat: make `--gas-report` JSON output compatible (#9063)

* add gas report generation in JSON

* skip junit for now

* add json formatted tests, trailing space and invalid formatting

* avoid redundant modifications for calls count

* replace existing tests with snapbox

* clean up snapbox tests

* merge in master

* calls -> frames

* use .is_jsonlines()

* chore: replace criterion with divan (#9080)

* chore: reduce length of a common error message (#9089)

* feat: update to Soldeer v0.4.1 (#9092)

Hotfix #212

* feat: bump alpine to `3.20.3` (#9094)

* feat: bump alpine to `3.20.3`

* feat: alpine v`3.20`

* chore: update chains (#9097)

* feat(cheatcodes): implement new cheatcode to check if a string contains another string (#9085)

* feat: implement new cheatcode to check if a string contains another string

* chore: make clippy and rustfmt happy

* chore: vm.contains should return a boolean

* Update testdata/cheats/Vm.sol

Co-authored-by: zerosnacks <[email protected]>

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: zerosnacks <[email protected]>

* chore: update `cheatcodes.json`

* chore: update var names

* chore: rename to `vm.contains`

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: Matt Solomon <[email protected]>

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: Matt Solomon <[email protected]>

* chore: address PR comments

---------

Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: Matt Solomon <[email protected]>

* chore(deps): weekly `cargo update` (#9100)

Locking 35 packages to latest compatible versions
    Updating alloy-dyn-abi v0.8.6 -> v0.8.7
    Updating alloy-json-abi v0.8.6 -> v0.8.7
    Updating alloy-primitives v0.8.6 -> v0.8.7
    Updating alloy-sol-macro v0.8.6 -> v0.8.7
    Updating alloy-sol-macro-expander v0.8.6 -> v0.8.7
    Updating alloy-sol-macro-input v0.8.6 -> v0.8.7
    Updating alloy-sol-type-parser v0.8.6 -> v0.8.7
    Updating alloy-sol-types v0.8.6 -> v0.8.7
    Updating async-compression v0.4.13 -> v0.4.14
    Updating aws-sdk-kms v1.46.0 -> v1.47.0
    Updating aws-sdk-sso v1.45.0 -> v1.46.0
    Updating aws-sdk-ssooidc v1.46.0 -> v1.47.0
    Updating aws-sdk-sts v1.45.0 -> v1.46.0
    Updating aws-smithy-runtime v1.7.1 -> v1.7.2
    Updating cc v1.1.28 -> v1.1.30
    Updating clap v4.5.19 -> v4.5.20
    Updating clap_builder v4.5.19 -> v4.5.20
    Updating clap_complete v4.5.32 -> v4.5.33
    Updating derive_builder v0.20.1 -> v0.20.2
    Updating derive_builder_core v0.20.1 -> v0.20.2
    Updating derive_builder_macro v0.20.1 -> v0.20.2
    Updating js-sys v0.3.70 -> v0.3.72
    Updating lru v0.12.4 -> v0.12.5
    Updating newtype-uuid v1.1.0 -> v1.1.2
    Updating proc-macro2 v1.0.86 -> v1.0.87
    Updating scc v2.2.0 -> v2.2.1
    Updating sdd v3.0.3 -> v3.0.4
    Updating syn-solidity v0.8.6 -> v0.8.7
    Updating wasm-bindgen v0.2.93 -> v0.2.95
    Updating wasm-bindgen-backend v0.2.93 -> v0.2.95
    Updating wasm-bindgen-futures v0.4.43 -> v0.4.45
    Updating wasm-bindgen-macro v0.2.93 -> v0.2.95
    Updating wasm-bindgen-macro-support v0.2.93 -> v0.2.95
    Updating wasm-bindgen-shared v0.2.93 -> v0.2.95
    Updating web-sys v0.3.70 -> v0.3.72
note: pass `--verbose` to see 10 unchanged dependencies behind latest

Co-authored-by: mattsse <[email protected]>

* feat(`cheatcodes`): vm.rememberKeys (#9087)

* feat(`cheatcodes`): vm.rememberKeys

* docs + return addresses + test

* remeberKeys with language

* doc nits

* cargo cheats

* set script wallet in config if unset

* nit

* test

* refactor(`cheatcodes`): mv `ScriptWallets` into `Cheatcode` (#9106)

* refactor(`cheatcodes`): mv `ScriptWallets` into `Cheatcode` from `CheatsConfig`

* nit

* rename `ScriptWallets` to `Wallets`

* rename cheatcode

* doc nits

* fix: running script with `--broadcast` for a transaction sequence can error out due to nonce desync from rpc latency (#9096)

* fix for issue #9095

* changed 'if' statement into 'match'

* fmt fix

* repeat ask for provider nonce on desync

* loop break and tokio::time use instead of std::thread

* fix(fmt): do not panic when no named arg (#9114)

* fix(traces): identify artifacts using both deployed and creation code (#9050)

* Identify by creation code

* Compute score for both creation and runtime code

* Fallback to deployed bytecode only if min creation bytecode score is under threshold

* reuse check closure, add basic test

* chore(`cheatcodes`): wallet nits (#9118)

* refactor(`script`): mv `ScriptSequence` to new crate (#9098)

* refac(`script`): extract script sequence and related types to new crate

* replace MultiChainSequence in script crate

* replace TransactionWithMetadata and AdditionalContract

* replace ScriptSequence

* replace all underlying ScriptSequence and related types

* doc nits

* add `ScriptTransactionBuilder`

* remove `TxWithMetadata`

* mv verify fns and use `ScriptSequence` directly

* clippy

* chore: remove duplicated RecordAccess

* fix: replace generic with dyn DatabaseExt

* chore: pending merge conflicts on script/src/lib.rs

* fix: f5aa05e upstream update compilation errors (#681)

* chore: update foundry-block-explorers

* chore: remove deployments from LocalTraceIdentifier

* fix: use dyn DatabaseExt in TraceCollector

* chore: fix duplicate method definition

* fix: solve some dependency issues in cheatcodes crate

* fix: adapt cheatcode crate to usage of dyn DatabaseExt

* fix: adapt to usage of hash maps with different hashes

* fix: further adaptations to dyn DatabaseExt usage

* fix: hardhat console import

* fix: adapt zk mock code to multiple calls (#9024)

* fix lifetime issues in trace_zksync

* inline env and l1_block_info fields

* fix: remove deployments and fix usage of different HashMaps on evm crate

* fix: remove stale std HashMap reference

* fix: clone zk_metadata before taking mutable reference

* fix: remove deployment references in forge

* fix: use u64 for gas limit

* fix: adapt to compiler optimize being an Option

* fix: restore lost code during conflict resolution in tests

* chore: remove uneeded uses of std HashMap

---------

Co-authored-by: Nisheeth Barthwal <[email protected]>

* fix: clippy

* fix: remove duplicate clippy ci job

* chore: fix codespell errors

* chore: remove ci success job

---------

Signed-off-by: Abhishekkochar <[email protected]>
Co-authored-by: DaniPopes <[email protected]>
Co-authored-by: grandizzy <[email protected]>
Co-authored-by: Léo Vincent <[email protected]>
Co-authored-by: Jennifer <[email protected]>
Co-authored-by: jenpaff <[email protected]>
Co-authored-by: Qiwei Yang <[email protected]>
Co-authored-by: aganisgash <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yash Atreya <[email protected]>
Co-authored-by: Igor Żuk <[email protected]>
Co-authored-by: N <[email protected]>
Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: grandizzy <[email protected]>
Co-authored-by: Drake Evans <[email protected]>
Co-authored-by: Arsenii Kulikov <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>
Co-authored-by: DaniPopes <[email protected]>
Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: mattsse <[email protected]>
Co-authored-by: Abhishek kochar <[email protected]>
Co-authored-by: Yotam Bar-On <[email protected]>
Co-authored-by: m4rio <[email protected]>
Co-authored-by: boolafish <[email protected]>
Co-authored-by: Giovanni Napoli <[email protected]>
Co-authored-by: Matt Solomon <[email protected]>
Co-authored-by: pogobounce <[email protected]>
Co-authored-by: Nisheeth Barthwal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleanup tx's result.deployments
3 participants